/**
 * Created by liuchuanyang on 2017/8/4.
 */
import PageItemCommonDef from '@jzl/utils/common/pi-common-def.js';
import _ from 'lodash';

import jzlButton from './button/def';
import jzlText from './text/def';

import jzlImage from './image/def';
import jzlLine from './line/def';
import jzlList from './list/def';

import jzlNav from './nav/def';
import jzlDataList from './data-list/def';
import jzlNotice from './notice/def';
import jzlSlider from './slider/def';
import jzlTextNav from './text-nav/def';
import jzlVideo from './video/def';
import jzlChartLine from './charts/line/def';
import jzlChartBar from './charts/bar/def';
import jzlChartPie from './charts/pie/def';
import jzlChartCard from './charts/card/def';
import jzlChartTable from './charts/table/def';

import JzlDataForm from './data-form/def';
import jzlLayout from './layout/def';
import jzlPageSub from './page-sub/def';
import jzlDataListH5 from './data-list/def-h5';
import jzlChartLineH5 from './charts/line/def-h5';
import jzlChartBarH5 from './charts/bar/def-h5';
import jzlChartPieH5 from './charts/pie/def-h5';

import jzlPageTabs from './tabs/def';
import jzlPageInput from './form-eles/input/def';
import jzlPageSwitch from './form-eles/switch/def';
import jzlPageSelect from './form-eles/select/def';
import jzlPageCascader from './form-eles/cascader/def';

import jzlPagePagination from './pagination/def'

import c$checkboxComp from './form-comps/checkbox/def';
import c$colorComp from './form-comps/color/def';
import c$fileComp from './form-comps/file/def';
import c$editorComp from './form-comps/editor/def';
import c$iconComp from './form-comps/icon/def';
import c$idcardComp from './form-comps/idcard/def';
import c$imageComp from './form-comps/image/def';
import c$inputComp from './form-comps/input/def';
import c$linkComp from './form-comps/link/def';
import c$matrixComp from './form-comps/matrix/def';
import c$mbComp from './form-comps/mb/def';
import c$numberComp from './form-comps/number/def';
import c$phoneComp from './form-comps/phone/def';
import c$radioComp from './form-comps/radio/def';
import c$roleComp from './form-comps/role/def';
import c$signComp from './form-comps/sign/def';
import c$sliderComp from './form-comps/slider/def';
import c$switchComp from './form-comps/switch/def';
import c$starComp from './form-comps/star/def';
import c$tagComp from './form-comps/tag/def';
import c$timeComp from './form-comps/time/def';
import c$videoComp from './form-comps/video/def';

// import jzlFilter    from './filter/def';
// import jzlEditor    from './editor/def';
// import jzlMainNav   from './mainnav/def';
// import jzlPayBtn    from './paybtn/def';
// import jzlTitle     from './title/def';

export default function (type) {
  let types = {
    jzlText,
    jzlImage,
    jzlButton,
    jzlVideo,
    // jzlFilter,
    jzlNav,
    jzlSlider,
    jzlList,
    // jzlMainNav,
    jzlTextNav,
    jzlNotice,
    // jzlPayBtn,
    jzlLine,
    jzlDataList,
    JzlDataForm,
    jzlChartLine,
    jzlChartBar,
    jzlChartPie,
    jzlChartCard,
    jzlChartTable,
    jzlLayout,
    jzlPageSub,
    jzlPageTabs,
    jzlPageInput,
    jzlPageSwitch,
    jzlPageSelect,
    jzlPageCascader,

    jzlPagePagination,

    c$inputComp,
    c$numberComp,
    c$radioComp,
    c$checkboxComp,
    c$switchComp,
    c$mbComp,
    c$phoneComp,
    c$editorComp,
    c$idcardComp,
    c$imageComp,
    c$fileComp,
    c$colorComp,
    c$iconComp,
    c$linkComp,
    c$matrixComp,
    c$roleComp,
    c$signComp,
    c$sliderComp,
    c$starComp,
    c$tagComp,
    c$timeComp,
    c$videoComp,
  };

  if (type === 2) {
    types['jzlDataList'] = jzlDataListH5;
    types['jzlChartLine'] = jzlChartLineH5;
    types['jzlChartBar'] = jzlChartBarH5;
    types['jzlChartPie'] = jzlChartPieH5;
  } else if (type === 5) {
    // types[ 'jzlDataList' ]  = jzlDataListPC;
    types['jzlChartLine'] = jzlChartLineH5;
    types['jzlChartBar'] = jzlChartBarH5;
    types['jzlChartPie'] = jzlChartPieH5;
  }

  for (let key in types) {
    types[key] = _.defaultsDeep(types[key], PageItemCommonDef);
  }
  return types;
}
